package com.wetool.wechat.model.official.menu;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * 菜单按钮组
 */
@Getter
@Setter
public class MenuGroup {

    /**
     * 按钮组
     */
    @JsonProperty(value = "button")
    private List<AbstractMenuButton> buttonList;

    public MenuGroup() {
        this.buttonList = new ArrayList<>();
    }

    /**
     * @param menuButton
     * @return
     */
    public boolean addButton(AbstractMenuButton menuButton) {
        if (this.buttonList.size() > 3) {
            return false;
        }
        this.buttonList.add(menuButton);
        return true;
    }

    /**
     * @param menuButton
     */
    public void deleteButton(AbstractMenuButton menuButton) {
        this.buttonList.remove(menuButton);
    }

}